<?php

namespace App\Console\Commands\Composer;

use Illuminate\Console\Command;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Support\Facades\Artisan;

class ImageResolutionCommand extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'image:add_resolution_command';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = '给 Image 添加 附加类';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return int
     */
    public function handle()
    {
        $dir = base_path('vendor/intervention/image/src/Intervention/Image/Gd/Commands');
        if (!is_dir($dir)) {
            mkdir($dir, 0777, true);
        }
        copy(resource_path('/vender/image/ResolutionCommand.tpl'), rtrim($dir, '/') . '/ResolutionCommand.php');
        return 0;
    }
}
